import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.hive.HiveContext
import org.apache.spark.{SparkConf, SparkContext}

object Main {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("Main").setMaster("yarn-client")
    val sc = new SparkContext(conf)
    val hive = new HiveContext(sc)
    val sqlContext = new SQLContext(sc)

    hive.sql("use hive")
    var xs = hive.sql("select * from sp_xs_xs");
    xs.filter("sfzx = 0").write.mode("overwrite").format("parquet").saveAsTable("zst_spark_test")
    println("write success")
  }
}
